package com.dahua.view;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.dahua.R;
import com.dahua.ui.main.TotalNumAct;

public class InfoDialog extends Dialog {

 private String content1,content2,check_detail,close;
 private Context context;

 public InfoDialog(@NonNull Context context, String content1,String content2,String check_detail,String close,int themeResId) {
  super(context, themeResId);
  this.context = context;
this.content1 = content1;
     this.content2 = content2;
this.check_detail=check_detail;
this.close = close;
 }

 private TextView text_content1,text_content2;
 private TextView text_detail,text_close;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dialog_view);
  //空白处不能取消动画
  setCanceledOnTouchOutside(false);
  //初始化界面控件
     text_content1 = findViewById(R.id.text_content1);
     text_content2 = findViewById(R.id.text_content2);
          text_detail= findViewById(R.id.text_detail);
          text_close= findViewById(R.id.text_close);

     text_content1.setText(content1);
     text_content2.setText(content2);
          text_detail.setText(check_detail);
          text_close.setText(close);


  text_detail.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
       dismiss();

    Intent intent = new Intent(context, TotalNumAct.class);
    context.startActivity(intent);
   }
  });

  text_close.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
        dismiss();
   }
  });
    }
}